package com.llq.report;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.llq.studentinfo.CourseSession;
import com.llq.util.LineUtil;

public class CourseReport{
//	public static final String NEWLINE = System.getProperty("line.separator");

	private List<CourseSession> sessions=new ArrayList<CourseSession>();
	public void add(CourseSession session) {
		sessions.add(session);
		
	}

	public String text() {
		Collections.sort(sessions);
		StringBuilder builder=new StringBuilder();
		for (CourseSession session : sessions) {
			builder.append(session.getCourse().getDepartment());
			builder.append(" ");
			builder.append(session.getCourse().getNumber());
			builder.append(LineUtil.NEWLINE);
		}
		return builder.toString();
	}

}
